import * as React from 'react';
import './App.css';
import { Icon } from 'antd';
import {
  Route, BrowserRouter
} from 'react-router-dom';
import { WrappedNormalLoginForm } from "./pages/login/login";
import { routerManger, RouteAdapter } from "./core/routeManager/routeManager";

class App extends React.Component<any, any> {
  routerRef: any
  componentDidMount() {
    const { history } = this.routerRef;
    const routeAdapter: RouteAdapter = {
      push(url: string) {
        history.push(url)
      }
    }
    routerManger.registerRouteAdapter(routeAdapter)
    console.log(this.routerRef)
  }
  render() {
    console.log(this.props)
    return (
      <div className="App">
        <BrowserRouter ref={(router) => this.routerRef = router}>
          <div>
            <Route path="/" component={() => (<Icon type="link" />)} />
            <Route path="/12" component={() => (<Icon type="step-forward" />)} />
            <Route path="/login" component={WrappedNormalLoginForm} />
          </div>
        </BrowserRouter>
      </div>
    );
  }
}

export default App;
